<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

<!DOCTYPE html>
<html>
<head>
	<title><spring:message code="message.title.zhuyonghu"/><spring:message code="message.button.add"/></title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp" %>
	<style type="text/css">
    .box-body{
    margin-top:-2px;
    }    	
    </style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
	<section class="content-header">
		<h1><spring:message code="message.title.zhuyonghu"/><spring:message code="message.button.add"/></h1>
		<ol class="breadcrumb">
			<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first" /></a></li>
			 <li class="active"><a href="#"><spring:message code="message.title.xiTongSheZhi" /></a></li>
             <li class="active"><a href="#"><spring:message code="message.title.yongHuGuanLi" /></a></li>
            <li class="active"><a href="#"><spring:message code="message.title.center_zhuyonghu" /></a></li>
		</ol>
	</section>

	<section class="content">
	  <form id="form" method="post" class="form-horizontal">
        <div class=" box box-success">
		  <div class="box-body"  >
		    <div class="input">	
		       <div class="textalign1"><spring:message code='message.lable.qiYeBianMa'/>：</div>
               <div class="boxinput">
                        <input type="text" class="textinput" id="compCode" placeholder="<spring:message code='message.lable.qiYeBianMa'/>">
               </div>
               <div class="textalign"><spring:message code='message.lable.qiYeMingCheng'/>：</div>
               <div class="boxinput">
                        <input type="text" class="textinput"  id="compName" placeholder="<spring:message code='message.lable.qiYeMingCheng'/>">
               </div>
               <div class="textalign"><spring:message code='message.lable.qiYeZhuCeLeiXing'/>：</div>
               <div class="boxinput">
                        <select class='textinput' id="compRegId" style="width: 100px;"></select>
						<select class='textinput' id="compRegId2" style="width: 100px;"></select>
               </div>
		    </div>
		    <div class="input" style="margin-top:-5px">	
		       <div class="textalign1"><spring:message code='message.lable.suoShuDiQu'/>：</div>
               <div class="boxinput">
                  <table style="width:100%;">
                    <tr>
                      <td style="width:33%">
                        <select class="textinput" id="area1" ></select> 
                      </td>  
                      <td style="width:33%">
						<select class="textinput" id="area2" ></select> 
					  </td>
					  <td style="width:33%">
						<select class="textinput" id="area3">
						    <option value=""><spring:message code="message.select.option"></spring:message> </option>
                        </select>
                       </td> 
                    </tr>  
                  </table>    
               </div>
               <div class="textalign">
                  <button type="button" onclick="search();"
						class="btn btn-success btn-sm"><spring:message code='message.button.seach'/></button>
               </div>
		    </div>
		  </div>
		</div> 
	  
	  
		<!--<div class=" box box-success">
			<div class="box-body">
				<div class=" form-inline">
					<div class="form-group form-group-xs">
						<label for="txtDrugName"><spring:message code='message.lable.qiYeBianMa'/>：</label> <input class="form-control"
					style="width: 302px;"		type="text" id="compCode" placeholder="<spring:message code='message.lable.qiYeBianMa'/>" />
					</div>
					<div class="form-group form-group-xs"  >
						<label for="txtDrugName"><spring:message code='message.lable.qiYeMingCheng'/>：</label> <input class="form-control"
					style="width: 302px;"		type="text" id="compName" placeholder="<spring:message code='message.lable.qiYeMingCheng'/>" />
					</div>
					<div class="form-group form-group-xs" style="margin-left: 0px;">
						<label for="txtDrugSpec"><spring:message code='message.lable.qiYeZhuCeLeiXing'/>：</label>
						 <select class='form-control' id="compRegId" style="width: 100px;"></select>
						 <select class='form-control' id="compRegId2" style="width: 100px;"></select>
					</div>
						<div class="form-group form-group-xs">
						<label for="txtDrugName"><spring:message code='message.lable.suoShuDiQu'/>：</label> 
						<select class="form-control" id="area1" style="width: 97px;"></select> 
						<select class="form-control" id="area2" style="width: 97px;"></select> 
						<select class="form-control" id="area3" style="width: 97px;">
						<option value=""><spring:message code="message.select.option"></spring:message> </option>
						</select>
					</div>
					<button type="button" onclick="search();"
						class="btn btn-success btn-sm"><spring:message code='message.button.seach'/></button>
				</div>
			</div>
		 </div>-->
		</form>
		<table class="jqgrid" id="gridlist"></table>
		<div id="gridpage"></div>
		  <div class=" box box-warning bottongroup">
      		  <a href="${ctx}/sysUser/zxUserList.html" class="btn btn-default btn-sm"><spring:message code='message.button.getBack'/></a>
    	</div>
	</section>
	<%@ include file="/WEB-INF/component/commonJS.jsp" %>
	<script type="text/javascript">
		$(function() {
			 $('.form-inline :input').bind('keydown', function(event) {if (event.keyCode == "13") {search();}}).eq(0).focus();
			 $("#area1").HNSelect({
		            url: "${pageContext.request.contextPath}/selectController/getArea.html", 
		            data: { ID: '000000' },  
		            defaultText: "<option value=''><spring:message code='message.select.option'/></option>",
		            func: function () {
		                 $("#area2").HNSelect({
		                    parent_selector: "#area1", 
		                    url: "${pageContext.request.contextPath}/selectController/getArea.html", 
		                    dataid: "ID",
		                    defaultText: "<option value=''><spring:message code='message.select.option'/></option>",
		                    		  func: function () {
		                                  $("#area3").HNSelect({
		                                      parent_selector: "#area2", 
		                                      url: "${pageContext.request.contextPath}/selectController/getArea.html", 
		                                      dataid: "ID", 
		                                      defaultText: "<option value=''><spring:message code='message.select.option'/></option>"
		                                  });
		                              }
		                }); 
		            }
		        }); 
			  
			  
				$("#compRegId").HNSelect({
		            url: "${ctx}/selectController/getDicCompType.html", 
		            data: {compRegId:""},
		            defaultText: "<option value=''>请选择</option>",
		            defaultselect: "${fatherCompRegType.compRegId}",
		            func: function () {
		                $("#compRegId2").HNSelect({
		                    parent_selector: "#compRegId", 
		                    url: "${ctx}/selectController/getDicCompType.html", 
		                    dataid: "compRegId",
		                    defaultText: "<option value=''>请选择</option>",
		                    defaultselect: "${compInfo.compReg.compRegId}"
		                });
		            }
		        });
			  
			$("#gridlist").jqGrid({
								url : "${ctx}/sysUser/getCompInfoList.html?compType=${userType}",
								mtype : "post",
								datatype : "json",
								autowidth : true,
								height : 255,
								colNames : [ '<spring:message code='message.jqGrid.cz'/>','id', '<spring:message code='message.lable.qiYeBianMa'/>', '<spring:message code='message.lable.qiYeMingCheng'/>', '<spring:message code='message.lable.qiYeShuXing'/>','<spring:message code='message.lable.zuZhiJiGouDaiMa'/>', '<spring:message code='message.lable.suoShuDiQu'/>', '<spring:message code='message.lable.qiYeZhuCeLeiXing'/>','<spring:message code='message.lable.status'/>'],
								colModel : [
											{name : 'operate',width : 30,align : "center",sortable : false,
												formatter : function(val, opts,rowdata) {
													var str="";
					                           		str += "<a href='javascript:generateAccount(\""+rowdata.compName+"\",\""+rowdata.compId+"\",${userType});'  style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -180px -80px' class='opIcon' title='<spring:message code='message.lable.shengChengZhangHao'/>'></a>";
													return str;
												}
											},
								            {name : 'compId',width : 100,align : "center",hidden : true,sortable : false},
											{name : 'compCode',width : 100,align : "center",sortable : false},
										    {name : 'compName',width : 130,align : "left",sortable : false},
										    {name : 'compType',width : 60,align : "center",sortable : false,
										    	formatter : function(val, opts,
														rowdata) {
													var str = "";
													if (rowdata.compType == 1) {
														str = "<spring:message code='message.model.shengChangeQiYe'/>";
													}
													if (rowdata.compType == 2) {
														str = "<spring:message code='message.model.peiSongQiYe'/>";
													}
													return str;
												}
										    },
										    {name : 'orgCode',width : 60,align : "center",sortable : false},
										    {name : 'arFullname',width : 60,align : "center",sortable : false},
										    {name : 'compRegName',width : 60,align : "center",sortable : false},
										    {name : 'status',width : 40,align : "center",sortable : false,
											formatter : function(val, opts,
													rowdata) {
												var str = "";
												if (rowdata.status == 1) {
													str = "<spring:message code='message.button.start'/>";
												}
												if (rowdata.status == 2) {
													str = "<spring:message code='message.button.stop'/>";
												}
												if (rowdata.status == 3) {
													str = "<spring:message code='message.button.combine'/>";
												}
												return str;
											}
										},
										 ],
								rowNum : 20,
								rowList : [ 10, 20, 30 ],
								rownumbers : true,
								pager : "#gridpage",
								viewrecords : true,
								caption : "<spring:message code='message.lable.qiYeXinXiLieBiao'/>",
							    gridComplete:function(){
				                    autoRNWidth("gridlist");
				                },
								jsonReader : {
									repeatitems : false,
									id : "ids"
								}
							});
			$("#gridlist").jqGrid('navGrid', '#gridpage', {
				add : false,
				edit : false,
				del : false,
				search : false,
				refresh : false
			});

			$(window).trigger("resize");
		});
	    function generateAccount(name,id,userType){
	    	$.HN.dialog.open({
	             id:id,
	             title:"<spring:message code="message.title.zhuyonghu"/><spring:message code="message.button.add"/>",
	             url:"${ctx}/sysUser/toGenerateAccount.html?id="+id+"&userType="+userType+"&name="+name,
	             width:"300px",
	             height:"185px",
	             closefunc:function(){
	            	 search();
	             }
	         });
    }
		function search() {
			var	area1 = $("#area1").val();
			var	area2 = $("#area2").val();
			var	area3 = $("#area3").val();
			var compRegId = $("#compRegId").val();
			var compRegId2 = $("#compRegId2").val();
			if(compRegId2!="" && compRegId2!=null){
				compRegId = compRegId2;
			}
			var compCode = $("#compCode").val();
			var compName = $("#compName").val();
			$("#gridlist").jqGrid('setGridParam',{
				                postData:{
				                	"area1":area1,
				                	"area2":area2,
				                	"area3":area3,
				                	"compRegId":compRegId,
				                	"compCode":compCode,
				                	"compName":compName
				                	},
				                page : 1

			
			}).trigger("reloadGrid");
		}
		
        function CurentTime(now)  
    	{       	         
    	    var year = now.getFullYear();   
    	    var month = now.getMonth() + 1; 
    	    var day = now.getDate();     
    	         
    	    var hh = now.getHours();       
    	    var mm = now.getMinutes(); 
    	    var ss=now.getSeconds(); 
    	    var clock = year + "-"; 
    	    if(month < 10) clock += "0";         
    	    clock += month + "-";  
    	    if(day < 10) clock += "0";   
    	    clock += day + " "; 
    	    if(hh < 10) clock += "0";  
    	    clock += hh + ":";  
    	    if (mm < 10) clock += '0';   
    	    clock += mm+ ":";  
    	    if (ss < 10) clock += '0';   
    	    clock += ss;  
    	    return(clock);   
    	}
        
	</script>
</body>
</html>









